package thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {
        Thread rose=new Thread("Rose"){
            @Override
            public void run() {

                for (int i = 0; i < 3; i++) {
                    System.out.println(getName()+" :Let me go!");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {

                    }
                }
                System.out.println(getName()+" : Ahhhhh...");
                System.out.println("Jump..");
            }
        };

        Thread jack=new Thread("Jack"){
            @Override
            public void run() {
                while(true){
                    System.out.println(getName()+" : You jump, I jump! ");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {

                    }
                }
            }
        };
        rose.start();
        jack.setDaemon(true);
        jack.start();
        System.out.println("main方法执行完毕");
        while(true);
    }
}
